package com.craney.testHit
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class TestHit
	{
		private var circle:Sprite = new Sprite();
		private var rect:Sprite = new Sprite();
		private var parentSprite:Sprite = new Sprite();
		private var count:uint = 0;
		private var num:uint = 0;
		private var last:Number;
		public function TestHit(ps:Sprite)
		{
			parentSprite = ps;
			
			circle.graphics.beginFill(0xaaaaaa);
			circle.graphics.drawCircle(0, 0, 60);
			circle.startDrag(true);
			circle.graphics.endFill();
			
			rect.graphics.beginFill(0x333333);
			rect.graphics.drawEllipse(110, 110, 150, 150);
			circle.graphics.endFill();
			
			parentSprite.addChild(circle);
			parentSprite.addChild(rect);
			last = new Date().time;
			parentSprite.addEventListener(Event.ENTER_FRAME, hit);
		}
		
		private function hit(event:Event):void
		{
			if(circle.hitTestObject(rect))
			{
				trace("Game Over!\t" + count++);
			}
//			var n:Number = new Date().time;
//			trace("None...\t" + num++ + "\t" + (n-last));
//			last = n;
		}
	}
}